Description:
Avoid testing floating point numbers for equality. Floating-point numbers that should be equal are not always equal due to rounding problems.
Incorrect:
void calc(double limit) {
if (limit == 0.0) {
...
}
}
Correct:
private const double EPS = 0.00001;
void calc(double limit) {
if (Math.Abs(limit) < EPS) {
...
}
}